package workspace.teaweb.Comment.controllers;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import workspace.teaweb.Comment.mappers.CommentMapper;
import workspace.teaweb.Comment.pojo.dto.CommentDTO;
import workspace.teaweb.Comment.pojo.entity.Comment;
import workspace.teaweb.Comment.service.CommentService;
import workspace.teaweb.base.response.JsonResult;

@Validated
@Slf4j
@Api(tags = "评论管理")
@RestController
@RequestMapping("/Comment")
public class CommentController {
    @Autowired
    private CommentService commentService;

    @PostMapping("/insert")
    public JsonResult addComment(Comment comment)
    {
        commentService.insert(comment);
        return JsonResult.ok("添加成功");
    }

    @PostMapping("/update")
    public JsonResult updateComment(CommentDTO commentDTO)
    {
        commentService.update(commentDTO);
        return JsonResult.ok("修改成功");
    }
}
